package com.aaa.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface S_NoticeDao {

    //" <if test=\"name!=null and name!=''\"> and ename like concat('%',#{name},'%')</if>"+
    //            "limit #{start},#{pageSize}</script>"
    @Select("<script>select id,title,issuer,release_time,click_rate from notice " +
            " where 1=1 " +
            " <if test=\"title!=null and title!=''\"> and title like concat('%',#{title},'%')</if></script>" )
    List<Map>selNotice(Map map);

    //   " <if test=\"name!=null and name!=''\"> and ename like concat('%',#{name},'%')</if> </script>"
    @Select("<script>select count(id) from notice" +
            " where 1=1 " +
            " <if test=\"title!=null and title!=''\"> and title like concat('%',#{title},'%')</if></script>")
    Integer getCount(Map map);


    @Delete("delete from notice where id=#{id}")
    int delNotice(Integer id);

    @Insert("insert into notice(title,issuer,click_rate) values(#{title},#{issuer},#{click_rate})")
    int addNotice(Map map);


    @Update("update notice set title=#{title},issuer=#{issuer},click_rate=#{click_rate} where id=#{id}")
    int updateNotice(Map map);


}
